The sensor of a bar code scanner is in the tip of a pen-like device. The sensor has a small light source and a photodetector. When the wand is passed over a ~UPC~ code, the sensor detects the thicknesses of the lines. These are interpreted as binary code and sent to the computer for processing.